package com.baichang.taoshunda.controller.mobile;

import com.baichang.framework.controller.BaseMobileController;
import com.baichang.framework.controller.IService;
import com.baichang.framework.excelption.ServiceException;
import com.baichang.taoshunda.controller.ControllerConstants;
import com.baichang.taoshunda.service.FeedBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by ${wushenglu} on 17/08/28.
 */
@Controller
@RequestMapping(ControllerConstants.FEEDBACK)
public class FeedBackMCtronller extends BaseMobileController{
    @Autowired
    private FeedBackService feedBackService;

    /**
     * 意见反馈
     *
     * @param request
     * @param response
     */
    @RequestMapping("/feedBack")
    public void feedBack(HttpServletRequest request, HttpServletResponse response) {
        initEncode(request, response, new IService() {
            @Override
            public Object init(HttpServletRequest request, HttpServletResponse response, String json) throws ServiceException {
                Integer userId = getInt(json, "userId", 0);
                String content = getString(json, "content", "");
                return feedBackService.userFeedBack(userId,content);
            }
        });
    }

}
